package dateapi;

import java.time.LocalDate;
import java.time.LocalTime;

public class DateTimeTest {
	public static void main(String[] a) {

		LocalDate now = LocalDate.now();

		// 获取指定年月日的localdate
		LocalDate date = LocalDate.of(2017, 5, 29);
		
		System.out.println("年：" + date.getYear());

		System.out.println("月:" + date.getMonthValue());

		System.out.println("几号:" + date.getDayOfMonth());

		System.out.println("星期几:" + date.getDayOfWeek().getValue());

		System.out.println("当年中的第几天:" + date.getDayOfYear());

		System.out.println("当月的天数:" + date.lengthOfMonth());

		System.out.println("当年的天数:" + date.lengthOfYear());
		
		//====
		
		//表示11:30分
        LocalTime time=LocalTime.of(11,30);

        //11:30:50
        LocalTime time2=LocalTime.of(11,30,50);

        System.out.println("时:"+time2.getHour());
        
        System.out.println("分:"+time2.getMinute());
        
        System.out.println("秒:"+time2.getSecond());
        
        LocalDate date1 = LocalDate.parse("2014-03-18");
        
        LocalTime time1 = LocalTime.parse("13:45:20");

 

	}
}
